import amesu from "../model/bot/amesu";
import func from "../model/func";
import { MsgAction, Tpl_Equip_strengthen } from "../shared/master/MsgAction";
import { style_default } from "../style/default";

export default async function (data: MsgAction) {
    let d = data.data as Tpl_Equip_strengthen;
    func.roundNumbers(d)
    let s = new style_default()
    if (d.jude) {
        s.setTitle(`${d.typeTitle}成功`,'✨')
    } else {
        s.setTitle(`${d.typeTitle}失败`,'😭')
    }
    s.addLine(`⚔️${d.info.name}Lv.${d.info.leve}`);
    s.addLine(`⭐️评分:${d.info.score}`);
    s.addLine('┄═⚙️属性变化═━');
    let change = 0;
    for (const key in d.att_now) {
        let now = d.att_now[key]
        let last = d.att_last[key]
        if (last == 0 && now == 0) {
            continue;
        }
        let changeIcon = '🤨';
        if (now > last) {
            changeIcon = '🔺';
            change += 1;
            s.addLine(`❇${func.getAttName(key)}${changeIcon}${(now - last).toFixed(2)}`)
        } else if (now < last) {
            changeIcon = '🔻';
            change += 1;
            s.addLine(`❌${func.getAttName(key)}${changeIcon}${(last - now).toFixed(2)}`)
        } else {
        }
    }
    if(change == 0){
        s.addLine('🙏属性没有发生任何变化');
        await s.addOne()
    }

    amesu.sendText(data.tolocation, s.end());
}